<?php

namespace backend\controllers;

use Yii;
use backend\models\search\UserCertificationSearch;
use backend\models\UserCertification;
use backend\actions\CreateAction;
use backend\actions\UpdateAction;
use backend\actions\IndexAction;
use backend\actions\DeleteAction;
use backend\actions\SortAction;
use backend\actions\ViewAction;

//TODO：设计后台首页显示未审核的认证提交数量
/**
 * UserCertificationController implements the CRUD actions for UserCertification model.
 */
class UserCertificationController extends \yii\web\Controller
{
    public function actions()
    {
        return [
            'index'      => [
                'class' => IndexAction::className(),
                'data'  => function () {

                    $searchModel  = new UserCertificationSearch();
                    $dataProvider = $searchModel->search(yii::$app->getRequest()->getQueryParams());

//                    var_dump($dataProvider->sort);
                    return [
                        'dataProvider' => $dataProvider,
                        'searchModel'  => $searchModel,
                    ];

                }
            ],
            'create'     => [
                'class'      => CreateAction::className(),
                'modelClass' => UserCertification::className(),
            ],
            'update'     => [
                'class'      => UpdateAction::className(),
                'modelClass' => UserCertification::className(),
            ],
            'delete'     => [
                'class'      => DeleteAction::className(),
                'modelClass' => UserCertification::className(),
            ],
            'sort'       => [
                'class'      => SortAction::className(),
                'modelClass' => UserCertification::className(),
            ],
            'view-layer' => [
                'class'      => ViewAction::className(),
                'modelClass' => UserCertification::className(),
            ],
            'view'       => [
                'class'      => ViewAction::className(),
                'modelClass' => UserCertification::className(),
            ],
        ];
    }
}
